package com.by;

import com.by.config.AppConfig;
import com.by.ioc.MyApplicationContext;
import com.by.run.MySpringApplication;
import com.by.service.PYB;
import com.by.service.UserService;

/**
 * Hello world!
 *
 */
public class Main {
    public static void main(String[] args) throws Exception {
        MySpringApplication.run(AppConfig.class, args);

        // 获取上下文
        MyApplicationContext context = MySpringApplication.getContext();

        // 获取 userService
        UserService userService = (UserService) context.getBean("userservice");
        PYB pyb= (PYB) context.getBean("pyb");
        if (userService == null) {
            System.out.println("userService is null!");
        } else {
            System.out.println("userService is successfully retrieved.");
            userService.getUserInfo();
            pyb.show();
        }
    }
}